package pj;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;

/**
 * 启动：Sa-OAuth2 Server端
 * @author click33
 */
@SpringBootApplication
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SaOAuth2ServerApplication {
	public static void main(String[] args) {
		SpringApplication.run(SaOAuth2ServerApplication.class, args);
		System.out.println("SpringCloudSecurity 和 Spring Security差异主要在引用的jar包不一样");
		System.out.println("当前 这个是SpringCloudSecurity项目");

		System.out.println("第一步：     浏览器访问 http://localhost:8080/oauth/authorize?response_type=code&client_id=1001&redirect_uri=http://localhost:8080/callback&scope=read%20write");
		System.out.println(" 用户名sa 密码 123456");
		System.out.println("第二步获取得到token：POST " +
				"Headers值如下"+
				"Content-Type: application/x-www-form-urlencoded\n" +
				"Authorization: Basic MTAwMTphYWFhLWJiYmItY2NjYy1kZGRkLWVlZWU= (Base64编码后的客户端ID:密钥)" +
				" http://localhost:8080/oauth/token?grant_type=authorization_code&code=MRxboO&redirect_uri=http://localhost:8080/callback (code来自第一步)\n");

		System.out.println("第三步验证token：GET " +
				"Headers值如下"+
				"Authorization: Bearer AuMLcB7OVLn84ZQTcs1ImvnmIiA (token来自第二步)\n" +
				"http://127.0.0.1:8080/api/sendMsgV3?msg=hello");

	}
}
